package com.example.hyclipboard;

public class FormChecker {
    private static int i_a = (int) 'a';
    private static int i_z = (int) 'z';
    private static int i_A = (int) 'A';
    private static int i_Z = (int) 'Z';
    private static int i_0 = (int) '0';
    private static int i_9 = (int) '9';

    public static boolean isOnlyLetterAndNumber(String str) {
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if ((!isLetter(ch)) && (!isNumber(ch))) return false;
        }
        return true;
    }

    private static boolean isLetter(char c) {
        int i = (int) c;
        return (i <= i_Z && i >= i_A) || (i <= i_z && i >= i_a);
    }

    private static boolean isNumber(char c) {
        int i = (int) c;
        return (i <= i_9 && i >= i_0);
    }
}
